Cookie

fun Cookie(domain: String, name: String = "", value: String = "", path: String = "", secure: Boolean = false, httpOnly: Boolean = false, creationTime: Instant = Instant.now(), expirationTime: Instant? = null, sameSite: SameSite = SameSite.LAX_MODE): Cookie
fun Cookie(domain: String, name: String = "", value: String = "", path: String = "", secure: Boolean = false, httpOnly: Boolean = false, creationTime: Instant = Instant.now(), expirationTime: Instant? = null, sameSite: SameSite = SameSite.LAX_MODE): Cookie

Creates a new instance of Cookie with the given parameters.

Since

8.0.0

Parameters

domain

A domain this cookie belongs to. Please note, the domain is also required for cookies with __Host prefix.

name

The cookie name.

value

The cookie value.

path

The cookie path.

secure

Specifies whether the cookie is restricted to a secure protocol (HTTPS or WSS), or it can be sent using any protocol.

httpOnly

Specifies whether the cookie is considered HTTP only.

creationTime

The cookie creation time.

expirationTime

The cookie expiration time. If not specified, the cookie is treated as a session cookie.

sameSite

The SameSite cookie attribute value that allows declaring if this cookie should be restricted to a first-part or same-site context. By default, it is set to LAX_MODE, which means cookies are only set when the domain in the URL of the browser matches the domain of the cookie – a first-party cookie. The NONE value requires the secure parameter to be true.